# 网格管理页面
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage
import uuid
import random


class DictManager(KeyWords):
    url = KeyWords.url + 'dictionary-list'

    #
    def create_dict_big_type(self):
        '''
        现建字典大类
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\dict_manager\create_dict_big_type.yaml')
        element_operation(self, data[0]['data'])

    def big_dict_list(self):
        '''
        字典大类列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\dict_manager\big_dict_list.yaml')
        element_operation(self, data[0]['data'])

    def big_dict_update(self):
        '''
        字典大类 编辑
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\dict_manager\big_dict_update.yaml')
        element_operation(self, data[0]['data'])

    def big_dict_stop(self):
        '''
        字典大类 停用和批量编辑
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\dict_manager\big_dict_stop.yaml')
        element_operation(self, data[0]['data'])

    def create_dict_small_type(self):
        '''
        新增字典项
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\dict_manager\create_dict_small_type.yaml')
        element_operation(self, data[0]['data'])

    def dict_small_type_list(self):
        '''
        字典项列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\dict_manager\dict_small_type_list.yaml')
        element_operation(self, data[0]['data'])

    def dict_small_type_update_and_sort(self):
        '''
        字典项列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\dict_manager\dict_small_type_update_and_sort.yaml')
        element_operation(self, data[0]['data'])

    def dict_small_type_stop_and_delete(self):
        '''
        字典项列表
        :return:
        '''
        data = get_data_by_yaml(get_path() + r'\Data\element_data\dict_manager\dict_small_type_stop_and_delete.yaml')
        element_operation(self, data[0]['data'])


if __name__ == '__main__':
    driver = choose_browser()
    L = LonginPage(driver)
    L.login('kobeAdmin002', 'kobe8888')
    case = DictManager(driver)
    case.dict_small_type_stop_and_delete()
    driver.quit()
